<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="__ROOT__/Public/Admin/css/shortcut icon" href="favicon.ico">
    <link href="__ROOT__/Public/Admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/animate.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/cityPicker/city-picker.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__ROOT__/Public/Admin/css/edit.css" rel="stylesheet"/>
<style>

</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
       
        <div class="row">
            <form class="form-horizontal m-t js-ajax-forms" id="signupForm" action="{:U('Admin/ProjectReview/save')}<if condition="$editdata">&type=update<else />&type=add</if>" method="post" enctype="multipart/form-data">
            <input type="hidden" name="ID" value="{$editdata['ID']}">
            <input type="hidden" name="expertformid" value="{$editdata['expertformid']}">
            <div class="col-sm-8  col-md-offset-2">

                <div class="ibox float-e-margins">
                    
                    <div class="ibox-content">

                            <div class="form-group">
                                <label class="col-sm-3 control-label">项目名称 *</label>
                                <div class="col-sm-8">
	                                <select class="form-control" id="ProjectID" name="ProjectID" aria-required="true" aria-invalid="true" class="error">
	                                	<option value="">请选择项目名称</option>
	                                	<foreach name="Projectdata" item="vo">
                                        	<option <if condition="$vo.ID eq $editdata['ProjectID']"> selected</if> value="{$vo.ID}">{$vo.Name}</option>
										</foreach>
	                                </select>
                                </div>
                            </div>
                            
                            <div class="form-group has-success">
                                <label class="col-sm-3 control-label" style="color:#686b6d">评审时间*</label>
                                <div class="col-sm-8">
                                    <input style="border-color:#cfdadd" type="text" id="ReviewTime" name="ReviewTime" class="form-control time laydate-icon"" value="{$editdata.ReviewTime}">
                                </div>
                            </div>
                          
                            <div class="form-group">
                                <label class="col-sm-3 control-label">评审地点</label>
                                <div class="col-sm-8">
                                    <input id="ReviewPlace" name="ReviewPlace" class="form-control" type="text"  value="{$editdata.ReviewPlace}">
                                </div>
                            </div>
                            
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">评审专家</label>
                                <div class="col-sm-8">
                                    <select class="form-control" id="ExpertID" name="ExpertID" aria-required="true" aria-invalid="true" class="error">
	                                	<option value="">请选择专家</option>
	                                	<foreach name="Expertdata" item="vo">
                                        	<option <if condition="$vo.ID eq $editdata['ExpertID']"> selected</if> value="{$vo.ID}">{$vo.TrueName}</option>
										</foreach>
	                                </select>
                                </div>
                            </div>
                            
                            
                            <div class="form-group">
                                <label class="col-sm-3 control-label">评审结果</label>
                                <div class="col-sm-8">
                                    <textarea id="Content" name="Content" class="form-control diff-textarea" rows="6">{$editdata.Content}</textarea>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary keep" type="submit">保存</button>
                                    <a class="btn btn-white" href="javascript:void(0);" onclick="self.location=document.referrer;">返回</a>
                                </div>
                            </div>
                        
                    </div>
                </div>
            </div>
           
            </form>
        </div>

    </div>

	<script src="__ROOT__/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
	<script src="__ROOT__/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/layer/laydate/laydate.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="__ROOT__/Public/Admin/js/ajaxForm.js"></script>
	<script src="__ROOT__/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
	
	<script>

        $(document).ready(function () {
			var icon = "<i class='fa fa-times-circle'></i>";
			var form = $('form.js-ajax-forms');
			var formloading = false;
			form.validate({
				ignore:"",
		        //验证规则
		        rules: {
		            ProjectID: {
		                required: true
		            }
		        },
		        //验证未通过提示消息
		        messages: {
		            ProjectID:{
		                required: icon + "请选择项目名称"
		            }
		        },
		        //验证通过，提交表单
		        submitHandler : function(forms) {
		        	if (formloading)
	                return;
		            $(forms).ajaxSubmit({
		                url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
		                dataType : 'json',
		                beforeSubmit : function(arr, $form, options) {
		                    formloading = true;
		                },
		                success : function(data, statusText, xhr, $form) {
		                    formloading = false;
		                    if (data.status) {
		                        //添加成功
		                        swal({
		                            title: "继续操作？",
		                            text: "操作成功！",
		                            type: "success",
		                            showCancelButton: true,
		                            confirmButtonColor: "#DD6B55",
		                            confirmButtonText: "确认",
		                            cancelButtonText: "返回",
		                            closeOnConfirm: false,
		                            closeOnCancel: false
		                        },
		                        function (isConfirm) {
		                            if (isConfirm) {
		                                document.location.reload();
		                            } else {
		                                document.location.href = "{:U('ProjectReview/index')}";
		                                return true;
		                            }
		                        }); 
		                    } else {
		                        swal("操作失败", data.info, "error");
		                    }
		                }
		            });
		        }
		    });
		});
		
        var ReviewTime = {
            elem: '#ReviewTime',
            format: 'YYYY-MM-DD hh:mm:ss',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
               // InputTime.min = datas; //开始日选好后，重置结束日的最小日期
            }
        };
        laydate(ReviewTime);
        //办理过程
        var busid = '{$busid}';
		var formid = '{$formid}';
		var taskID = parent.taskID;
        if(busid != null){
        	data = {
        		"busid":busid,
        		"formid":formid
        	}
			$(".loading").show();
        	$.post("{:U('Admin/TaskProcess/getRihtByXid')}",data,function(result){
        		$(".loading").hide();
        		for(var k in result){
        			switch(result[k].RightType){
        				case "0":
        					$("#"+result[k].IDName).parent().parent().css("display","none");
        					break;
        				case "1":
        					$("#"+result[k].IDName).attr("readonly",true);
        					$("#"+result[k].IDName).attr("disabled",true);
        					$("#"+result[k].IDName).attr("class","form-control");
        					break;
        				case "2":
        					break;
        				default:
        					break;
        			}
        		}
        	});
        }
        if(taskID != null){
        	$(".taskID").val(taskID);
        }
	</script>
</body>

</html>
